package com.irdstudio.apicenter.console.service.authenticate;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppDuty;
import com.irdstudio.apicenter.console.dm.AppRole;
import com.irdstudio.apicenter.console.dm.AppUser;
import com.irdstudio.apicenter.console.dm.AppUserDao;

@Service(value = "appUserService")
public class AppUserService {
	@Autowired
	private AppUserDao appUserDao;

	public int insertOne(AppUser appUser) throws SQLException,
			ClassNotFoundException {
		return appUserDao.saveAppUser(appUser);
	}

	public AppUser queryAppTradePrivate(String appId, String userId)
			throws SQLException {
		return appUserDao.queryWithKeys(appId, userId);
	}

	public int update(AppUser appUser) throws SQLException,
			ClassNotFoundException {
		return appUserDao.update(appUser);
	}

	public List<AppRole> queryAppRoleListNotYet(String userid, String appid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.queryAppRoleListNotYet(userid, appid);
	}

	public List<AppDuty> queryAppDutyListNotYet(String userid, String appid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.queryAppDutyListNotYet(userid, appid);
	}

	public List<AppRole> queryAppRoleListAready(String userid, String appid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.queryAppRoleListAready(userid, appid);
	}

	public List<AppDuty> queryAppDutyListAready(String userid, String appid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.queryAppDutyListAready(userid, appid);
	}

	public int insertUserRole(String roleStr, String appid, String userid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.insertUserRole(roleStr, appid, userid);
	}

	public int insertUserDuty(String dutyStr, String appid, String userid)
			throws SQLException {
		// TODO Auto-generated method stub
		return appUserDao.insertUserDuty(dutyStr, appid, userid);
	}

}
